<template>
<view>
<view v-for="(item, index) in notices" :key="index" @tap="showindexdesc" class="tanchu_miaoshu_border" :data-id="item.id" v-if="notices.length>0">
    <view :class="'tanchu_miaoshu_border_right ' + (clicknotice==item.id?'':'tanchu_miaoshu_border_right_active')">
        <image class="tanchu_miaoshu_border_dian" src="/static/pages/image/xiaoxi_btn.png"></image>
        <view class="miaoshu_border_title">{{item.content?item.content:''}}</view>
        <text>  {{item.desc?item.desc:''}}</text>
    </view>
</view>
<block v-if="notices.length<=0">
    <!--<import src="/pages/data_null/index.wxml"></import>-->
    <view>
        <block data-type="template" data-is="title" data-attr="title:'暂无公告数据'">
    <view class="zanwushuju_border">
        <image class="zanwushuju_border_img" src="/static/pages/image/none_message.png"></image>
        <view class="zanwushuju_border_title">{{'暂无收藏数据'}}</view>
    </view>
</block>
    </view>
</block>
</view>
</template>

<script>
var app = getApp(),
    leftid = 2;

export default {
  data() {
    return {
      notices: [],
      clicknotice: "",
      dropdown: 1
    };
  },

  components: {},
  props: {},
  onLoad: function (t) {
    var a = this;
    app.globalData.util.request({
      url: "entry/wxapp/Api",
      data: {
        m: "monai_market",
        leftid: "",
        r: "sale.index.getnotice"
      },
      cachetime: "0",
      success: function (t) {
        a.setData({
          notices: t.data.data
        });
      }
    });
  },
  onReachBottom: function () {
    var i = this,
        n = i.notices;
    2 != i.dropdown && (i.dropdown = 2, app.globalData.util.request({
      url: "entry/wxapp/Api",
      data: {
        m: "monai_market",
        leftid: leftid,
        r: "sale.salelist.getnotice"
      },
      success: function (t) {
        var a = t.data.data.length;
        if (leftid++, 0 < a) for (var e = 0; e < a; e++) n.push(t.data.data[e]);
        i.setData({
          notices: n
        });
      },
      complete: function () {
        i.dropdown = 1;
      }
    }));
  },
  methods: {
    showindexdesc: function (t) {
      console.log(t.currentTarget.dataset.id), this.setData({
        clicknotice: t.currentTarget.dataset.id
      });
    }
  }
};
</script>
<style>
@import "./index.css";
</style>